<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c"%>
<%@ taglib uri="/resource/UserPwoer.tld" prefix="p"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<c:set var="path" value="${pageContext.request.contextPath }" />
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="content-type" content="text/html;charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>支付</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<script type="text/javascript"
	src="${path }/resource/js/jquery-2.1.4.min.js"></script>
<script type="text/javascript"
	src="${path }/resource/js/systools/DDMBase.js"></script>
<link rel="stylesheet"
	href="${path }/resource/weixin/css/personal-msg.css">
<style type="text/css">
.none {
	display: none;
}
</style>
</head>
<body>
	<!-- 头部 -->
	<jsp:include page="_top.jsp"></jsp:include>
	<!-- 内容 -->
	<!-- 导航 -->
	<div class="padding-1 color-9">
		<span class="color-9">订单支付</span>
	</div>
	<div class="padding-1 user-div back-w color-9">
		订单号：${order.orderNo }</div>
	<div class="padding-1 user-div back-w color-9">
		商品信息：${order.orderNo }</div>
	<div class="padding-1 user-div back-w color-9">
		支付金额：<span class="color-y font-w6">￥${order.total }</span>
	</div>
	<div class="margin-1 margin-t1 ">
		<button id="getBrandWCPayRequest" onclick="myForm.submit()"
			class="color-w back-y psw-btn">支付</button>
	</div>
	<script type="text/javascript">
		//当微信内置浏览器完成内部初始化后会触发WeixinJSBridgeReady事件。
		document.addEventListener('WeixinJSBridgeReady',
				function onBridgeReady() {
					//公众号支付
					$('#getBrandWCPayRequest').click(function(e) {
						WeixinJSBridge.invoke('getBrandWCPayRequest', {
							"appId" : "${payData.appId}", // 公众号名称，由商户传入
							"timeStamp" : "${payData.timeStamp}", // 时间戳，自1970年以来的秒数
							"nonceStr" : "${payData.nonceStr}", // 随机串
							"package" : "${payData.prepay_id}",
							"signType" : "${payData.signType}", // 微信签名方式:
							"paySign" : "${payData.paySign}" // 微信签名
						}, function(res) {
							if (res.err_msg == "get_brand_wcpay_request:ok") {
								$.AjaxProxy().invoke("${path}/customer/goodsPay/fyOrderPaySuccess?page=${order.orderNo}",function(loj){
									 layer.open({
										    content: loj.getValue("info")
										    ,btn: '确定',
										    end:function(){
										    	MTools.redirect("${path}/"+loj.getValue("page"));
										    }
										  });
								});
								
							} else {
								alert(JSON.stringify(res));
							}
						});
					});
					WeixinJSBridge.log('yo~ ready.');
				}, false);
	</script>

	<p class="none">
		${msg} <br> "appId" : "${payData.appId}",<br> "timeStamp" :
		"${payData.timeStamp}", <br> "nonceStr" : "${payData.nonceStr}",<br>
		"package" : "${payData.prepay_id}",<br> "signType" :
		"${payData.signType}", <br> "paySign" : "${payData.paySign}" <br>
	</p>
</body>
</html>